config:
	@echo $@ done

build:
	@mkdir -p debian
	@sudo debootstrap --foreign --arch armhf jessie debian http://ftp.cn.debian.org/debian/
	@sudo cp /usr/bin/qemu-arm-static debian/usr/bin/
	@sudo chroot debian /debootstrap/debootstrap --second-stage
	@sudo cp update/* -av debian
	@sudo chroot debian /usr/bin/apt-get update
	@echo yes | sudo chroot debian /usr/bin/apt-get install mtd-utils alsa-utils tftp can-utils
	@sudo rm debian/var/cache/apt/archives/* -rf
	@echo $@ done

clean:
	@rm -rf debian
	@echo $@ done

install:
	@mkdir -p $(DEBIAN_INSTALL)
	@sudo cp debian/* -av $(DEBIAN_INSTALL)
	@sudo cp update/* -av $(DEBIAN_INSTALL)
	@sudo chown `whoami` -R $(DEBIAN_INSTALL)
	@echo $@ done
